<template lang="pug">
  yd-list(theme='4')
        yd-list-item(v-for="item in items",:key="item.tid",type='div',@click.native="appointment(item)")
            img(slot='img', :src='item.imgurl')
            span(slot='title') {{item.tname}}
            yd-list-other(slot='other')
                div 时长 {{item.time}}分钟
</template>
<script>
import { mapMutations } from "vuex";
export default {
  data() {
    return {
      items: []
    };
  },
  created() {
    this.getData();
  },
  methods: {
    ...mapMutations(["selectItem"]),
    getData() {
      this.$api.v1
        .common_storeItems_post({ data: { sid: window.data.sid } })
        .then(resp => {
          this.items = resp.data.data;
        });
    },
    appointment(item) {
      this.selectItem(item);
      this.$router.push("/appointment");
    }
  }
};
</script>

<style lang="stylus">
.yd-list-theme4 {
  .yd-list-item {
    .yd-list-img {
      height: auto;
      padding: 0;

      img {
        margin: 0;
      }
    }

    .yd-list-mes {
      .yd-list-other {
        margin-top: 0.3rem;
      }
    }
  }
}
</style>

